package com.itliang.service.hardware.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itliang.core.model.dto.equipment.NormalRangeQueryRequest;
import com.itliang.core.model.entity.equipment.NormalRange;
import com.itliang.core.model.vo.equipment.NormalRangeVO;
import com.itliang.mapper.hardware.NormalRangeMapper;
import com.itliang.service.hardware.NormalRangeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author liangzhuoyuan
 * @description 针对表【normal_range(正常范围数据表)】的数据库操作Service实现
 */
@Service
public class NormalRangeServiceImpl extends ServiceImpl<NormalRangeMapper, NormalRange>
        implements NormalRangeService {

    @Resource
    private NormalRangeMapper normalRangeMapper;

    @Override
    public NormalRange getNormalRangeByDataType(int dataType) {
        LambdaQueryWrapper<NormalRange> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(NormalRange::getDataType, dataType)
                .eq(NormalRange::getStatus, 1);
        return this.getOne(queryWrapper);
    }

    @Override
    public Page<NormalRangeVO> listNormalRangeByPage(Page<Object> objectPage, NormalRangeQueryRequest normalRangeQueryRequest) {
        return normalRangeMapper.listNormalRangeByPage(objectPage, normalRangeQueryRequest);
    }

}




